/*
 * Copyright (C) 2024-2025 Deepin Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#pragma once

#include "gsettingkey.h"
#include "common/systemsettings.h"

#include <QObject>

class DBusInvokerInterface;
class SettingsInvokerInterface;

class LoginSafetyModel : public QObject
{
    Q_OBJECT
public:
    explicit LoginSafetyModel(QObject *parent = nullptr);
    ~LoginSafetyModel();

    // 开启/关闭密码限制策略
    void setPwdLimitPolicyEnable(const bool &enable);
    // 获取登录安全等级
    int getPwdLimitLevel() const;
    // 设置登录安全等级
    void setPwdLimitLevel(const int level);
    // 获取密码到期提醒截止天数类型
    int getPwdChangeDeadlineType() const;
    // 设置密码到期提醒截止天数类型
    Q_SLOT void setPwdChangeDeadlineType(const int &type);
    // 打开控制中心账号页
    Q_SLOT void jumpToAccountSettingPage();

Q_SIGNALS:
    // 设置登录安全等级完成信号
    void setPwdLimitedLevelFinished(int level);

    void systemSecurityLevelChanged(int level);

public Q_SLOTS:
    void onSetPwdLimitedLevelFinished(int level);
    void onSettingChanged(const QString &key, const QVariant &value);
    // 获取等保级别
    void syncSystemSecurityLevel();

private:
    SettingsInvokerInterface *m_gSettingsInvokerInter;
    DBusInvokerInterface *m_loginSafetyInvokerInter;
    DBusInvokerInterface *m_controlCenterInvokerInter;
    DBusInvokerInterface *m_netMonitorInvokInter;
    def::SystemSettings *m_setting;
};
